package hu.mapro.gwtui.client.model;

import hu.mapro.gwtui.client.browser.BuildsColumn;
import hu.mapro.gwtui.client.browser.ColumnBuilder;
import hu.mapro.gwtui.client.browser.TableBuilder;
import hu.mapro.gwtui.client.browser.TableUtils;



public abstract class AbstractDisplayableProperty<T, D> extends AbstractProperty<T, D> implements DisplayableProperty<T, D>, BuildsColumn<T, D>  {

	DisplaySize displaySize;

	public AbstractDisplayableProperty(
			String propertyName,
			String label, 
			DisplaySize displaySize
	) {
		super(propertyName, label);
		this.displaySize = displaySize;
	}

	public AbstractDisplayableProperty(String propertyName, String label) {
		this(propertyName, label, DisplaySize.DEFAULT);
	}

	@Override
	public DisplaySize getDisplaySize() {
		return displaySize;
	}

	@Override
	public String getPath() {
		return propertyName; 
	}

	@Override
	public void build(ColumnBuilder<T, D> builder) {
		TableUtils.buildColumn(builder, this);
	}
	
}
